﻿namespace TA.Turbo.Controls
{
	using System;
	using System.Web.UI;

	/// <summary>
	/// Standard button. Click can be processed both on the client and on the server.
	/// </summary>
	public class Button : BaseButton
	{
		#region INTERNAL
		#region METHODS
		#region INIT
		/// <summary>
		/// Registers Button.js.
		/// </summary>
		protected internal override void RegisterIncludes(IncludeCollection includes)
		{
			base.RegisterIncludes(includes);

			includes.Add(new ScriptResourceInclude("TA.Turbo.Res.JS.Simple.InputControl.js", typeof(BaseCommandControl)));
			includes.Add(new ScriptResourceInclude("TA.Turbo.Res.JS.Simple.Button.js", typeof(BaseCommandControl)));
		}
		#endregion
		#region RENDER
		/// <summary>
		/// Adds type and value attributes.
		/// </summary>
		/// <param name="writer"></param>
		protected override void AddAttributesToRender(HtmlTextWriter writer)
		{
			base.AddAttributesToRender(writer);
			writer.AddAttribute(HtmlTextWriterAttribute.Type, "submit");
			writer.AddAttribute(HtmlTextWriterAttribute.Value, base.Text);
		}
		#endregion
		#endregion
		#endregion
	}
}

